package club.caihappy.controller;

import club.caihappy.pojo.User;
import com.sun.org.glassfish.gmbal.ParameterNames;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by 百岁 on 2021/9/12
 **/
@Controller
@RequestMapping("/user")
public class UserController {
    @RequestMapping("/t1")
    public String test1(@RequestParam("username") String name, Model model) {
        model.addAttribute("msg", "名字是:" + name);
        return "hello";
    }

    @RequestMapping("/t2")
    public String test2(User user,Model model) {
        model.addAttribute("msg",user);
        return "hello";
    }
}
